/**
 *
 */
package com.naiterui.ehp.bp.support.security;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author guoyongxiang
 * @since 1.0.0
 */
public class PharmacistLoginInterceptor extends AbstractLoginInterceptor {

    private static final Logger LOGGER = LoggerFactory.getLogger(PharmacistLoginInterceptor.class);

    @Override
    protected void printAccessLog(HttpServletRequest request) {

        String origin = request.getHeader(HeaderConstant.HEADER_ORIGIN);
        String inner = request.getHeader(SettingConfig.HEADER_INNER);
        String platform = request.getHeader(HeaderConstant.HEADER_PLATFORM);
        String version = request.getHeader(HeaderConstant.HEADER_VERSION);
        String h5Version = request.getHeader(HeaderConstant.HEADER_NATIVE_VERSION);
        String url = request.getServletPath();

        String pharmacistId = request.getParameter(SettingConfig.PHARMACIST_ID);
        String token = request.getParameter(SettingConfig.TOKEN);

        LOGGER.info("==请求平台来源_p={}, _o={}, 版本号_v={}, _nv={}, inner={}, 请求路径url={}, 请求参数===pharmacistId={},token={}", platform, origin, version, h5Version,
                inner, url, pharmacistId, token);
    }

    @Override
    protected final void settingNosignUri(List<String> nosignUri) {
        // swagger
        nosignUri.add("/swagger-ui.html");
        nosignUri.add("/webjars/**");
        nosignUri.add("/swagger-resources/**");
        nosignUri.add("/v2/api-docs");

        // 客户端升级&升级配置JSP
        nosignUri.add("/pharmacist/checkVersion");
        nosignUri.add("/pharmacist/saveVersion");

        // 登录 & 注册 & 获取短信验证码
        nosignUri.add("/pharmacist/login");
        nosignUri.add("/pharmacist/login/*");
        nosignUri.add("/pharmacist/sendSms");
        nosignUri.add("/pharmacist/time.jsp");

        nosignUri.add("/pharmacist/openapi/**");

        // 全局配置接口
        nosignUri.add("/pharmacist/user/globalConfig");
        // 处理审核药师Id
        nosignUri.add("/pharmacist/inner/recommend/handle/audit/pharmacist");
        nosignUri.add("/pharmacist/inner/recommend/audit/pharmacist/*");
        nosignUri.add("/pharmacist/user/getAuthDetail");
        nosignUri.add("/pharmacist/login/realname/*");
    }

}